<?php
/**
 * Created by PhpStorm.
 * 消息队列job类
 * User: gxk
 * Date: 2019/4/25
 * Time: 11:00
 */

namespace Library;
class ResqueJob
{
    //运行作业之前调用
    public function setUp()
    {
        echo '运行作业之前调用';
        // ... Set up environment for this job
    }
    //运行作业之后调用
    public function tearDown()
    {
        echo '运行作业之后调用';
        // ... Remove environment for this job
    }
    //运行处理作业
    public function perform()
    {
//        fwrite(STDOUT, 'Start job! -> ');
        $arr = $this->args;
        $this->{$arr['method']}($arr['args']);
//        fwrite(STDOUT, 'Job ended!' . PHP_EOL);
    }
    public function chat($data)
    {
        M()::table('chat')->insert($data);
    }
}